package edu.boston.cs633.shared;

import java.io.Serializable;

public class StockPrice implements Serializable {
    private static final long serialVersionUID = 1L;
    private String symbol;
    private double price;
    private double change;
    private String companyName;
    private String sector;
    private String industry;

    public StockPrice() {

    }

    public StockPrice(String symbol) {
        this.symbol = symbol;
    }

    public StockPrice(String symbol, double price, double change) {
        this.symbol = symbol;
        this.price = price;
        this.change = change;
    }

    public String getSymbol() {
        return this.symbol;
    }

    public double getPrice() {
        return this.price;
    }

    public double getChange() {
        return this.change;
    }

    public double getChangePercent() {
        return 100.0 * this.change / this.price;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setChange(double change) {
        this.change = change;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getSector() {
        return sector;
    }

    public void setSector(String sector) {
        this.sector = sector;
    }

    public String getIndustry() {
        return industry;
    }

    public void setIndustry(String industry) {
        this.industry = industry;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof StockPrice) //check the cast
            if (((StockPrice) o).symbol.equals(this.symbol)) //compare
                return true; //is the same
            else
                return false;
        else
            return false;
    }
}
